<template>
  <div class="rolljackpot">
    <ul>
      <li  v-for="(item ,index) in list" :key="index">
        <div class="cent1">
          <div><img :src="item.image" ></div>
        </div>
        <div class="poplpel">
          <div v-if="item.user" class="cent2"><div><img :src="item.user.photo" ></div><p>{{item.user.nickName}}</p></div>
        </div>
        <div class="cent3">{{item.name}}</div>
        <div class="cent4"><img src="../assets/money-icon.png" >{{item.price}}</div>
      </li>
    </ul>
    <div @click="addlist()" v-show="pageTotal > pageNum" class="addloding"></div>
  </div>
</template>

<script>
  export default {
    data() {
      return{
        zhong: true,
        list: [],
        pageNum: 1,
        pageTotal: 1
      }
    },
    methods:{
      reloadData() {
        this.pageNum = 1
        this.getSkinList()
      },
      addlist(){
        if (this.pageTotal > this.pageNum) {
          this.pageNum ++
          this.getSkinList()
        }
      },
      getSkinList() {
        this.$api.get('/api/roll/skin/info', {
          id: this.$store.state.currentRoolRoom.id,
          pageNum: this.pageNum,
          pageSize: 30
        }, res => {
          if (res.code === 200) {
            if (this.pageNum === 1) {
              this.list = res.data.content
            } else {
              this.list = [ ... this.list, ... res.data.content]
            }
            this.pageTotal = res.data.totalPages
          }
        })
      }
    },
    created() {
      this.getSkinList()
    }
  }
</script>

<style >
  .rolljackpot .addloding{
    background-image: url(../assets/jzgd-icon.png);
    background-size: 100% 100%;
    width: 174px;
    height: 35px;
    margin: 0 auto;
    cursor: pointer;
    margin-top: 30px;
  }
  .rolljackpot ul li .cent4{
    margin-top: 10px;
    color: #FFA32A;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  .rolljackpot ul li .cent4 img{
    margin-right: 5px;
  }
  .rolljackpot ul li .cent3{
    width: 100%;
    height: 26px;
    /* background-image: url(../assets/hbb-btn-bgs.png);
    background-size: 100% 100%; */
    line-height: 26px;
    font-size: 12px;
    color:#A8ECF9;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 15px;
    box-sizing: border-box;
    margin-top: 5px;
  }
  .rolljackpot .poplpel{
    height: 40px;
    margin: -30px auto 0;
    width: 153px;
    height: 40px;
  }
  .rolljackpot ul li .cent2>div{
    width: 38px;
    height: 38px;
    border: 1px solid #4169A6;
    border-radius: 50%;
    overflow: hidden;
    margin-right: 15px;
  }
  .rolljackpot ul li .cent2>div img{
    width: 100%;
    height: 100%;
  }
  .rolljackpot ul li .cent2{
    width: 153px;
    height: 40px;
    background-image: url(../assets/roll-titlit-bg.png);
    background-size: 100% 100%;
    border-radius: 20px 0 0 20px;
    display: flex;
    align-items: center;
    font-size: 12px;
    color: #92FFFB;
  }
  .rolljackpot ul li .cent1>div{
    width: 167px;
    height: 167px;
    position: relative;
  }
  .rolljackpot ul li .cent1>div img{
    position: absolute;
    top: 50%;
    left: 50%;
    width: auto;
    height: auto;
    max-width: 167px;
    max-height: 167px;
    transform:translate(-50%, -50%);
  }
  .rolljackpot ul li .cent1{
    width: 167px;
    height: 167px;
    background-image: url(../assets/hbb-list-bg.png);
    background-size: 100% 100%;
  }
  .rolljackpot ul li{
    width: 167px;
    margin-bottom: 30px;
    margin-right: 25px;
  }
  .rolljackpot ul li:nth-child(6n){
    margin-right: 0;
  }
  .rolljackpot ul{
    display: flex;
    align-content: flex-start;
    flex-wrap: wrap;
  }
  .rolljackpot{
    padding: 30px 24px;
    width: 100%;
  }
</style>
